import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GaoBo
 * Date: 2021-06-01
 * Time: 16:25
 */
class Student implements Comparable<Student>{
    private int age;
    private String name;

    public Student(int age, String name) {
        this.age = age;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        return this.age-o.age;
    }
}
public class TestDemo {

    public static void main(String[] args) {

    }

    public static void main7(String[] args) {
        String str1 = "welcome to bit";
        String str2 = "come";
        ArrayList<Character> list = new ArrayList<>();
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if(!str2.contains(ch+"")) {
                list.add(ch);
            }
        }
        //System.out.println(list);
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i));
        }
    }

    public static void main5(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(4);
        list.add(3);
        Collections.sort(list);
        System.out.println(list);
    }

    public static void main6(String[] args) {
        ArrayList<Student> students = new ArrayList<>();
        students.add(new Student(19,"bit"));
        students.add(new Student(29,"gaob"));
        students.add(new Student(5,"123"));
        //System.out.println(students);
        // 对自定义类型 排序的时候 需要实现接口
        Collections.sort(students);
        System.out.println(students);
    }

    public static void main4(String[] args) {
        LinkedList<Integer> linkedList = new LinkedList<>();
        linkedList.addLast(1);
        linkedList.add(0,10);
    }


    public static void main3(String[] args) {
        ArrayList<Integer> list1 = new ArrayList<>();
        ArrayList<Integer> list2 = new ArrayList<>(30);
        ArrayList<Integer> list3 = new ArrayList<>(list1);
    }


    public static void main2(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(11);
        list.add(22);
        list.add(33);
        list.add(44);
        list.add(55);
        list.add(66);

        System.out.println(list);
        /*
          1、subList(1,4)  -> [1,4)
          2、subList并不是 截取出来的一个新的数组 而是原来的数组
         */
        List<Integer> eList = list.subList(1,4);
        System.out.println(eList);
        System.out.println("===================");
        eList.set(1,133);
        System.out.println("修改截取的："+ eList);
        System.out.println("原来的："+list);


         /* //list.set(1,100);
        //System.out.println(list);
        System.out.println(list.indexOf(22));
        System.out.println(list.lastIndexOf(22));


      list.clear();
        System.out.println("===============");
        System.out.println(list);

        boolean flg = list.contains(11);
        System.out.println(flg);*/



       /* int x = list.remove(1);
        System.out.println(x);

        boolean flg = list.remove(list.get(1));

        System.out.println(flg);

        System.out.println(list);

        int x = list.get(0);
        System.out.println(x);*/
    }
    public static void main1(String[] args) {
        //顺序表
        List<Integer> list = new ArrayList<>();
        list.add(9);//10
        list.add(1,20);//20 9

        ArrayList<String> list2 = new ArrayList<>();

        //list.addAll(list2);//20 10 1 2 3 4
        System.out.println(list);

        System.out.println("===================");

        //迭代器
        Iterator<Integer> it = list.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
            // TODO:去查资料了解it.remove()需要注意的问题
            //it.remove();
        }

        System.out.println("==================");
        for (Integer x : list) {

        }
    }
}
